﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace MagicCardManager
{
    public partial class Form_AddEdition : Form
    {
        private SqLiteHandle sqlHndl = null;
        private DataSet inSet = null;
        private DataSet outSet = null;
        private string source = null;

        public Form_AddEdition()
        {
            InitializeComponent();
        }

        private void Form_AddEdition_Load(object sender, EventArgs e)
        {

        }

        private void btn_Add_Click(object sender, EventArgs e)
        {
            
            outSet = null;
            outSet = new DataSet();

            DataTable tableCard = new DataTable("edition_list");
            DataColumn column;
            DataRow row;
            // Create new DataColumn, set DataType, 
            // ColumnName and add to DataTable.    
            //column = new DataColumn();
            //column.DataType = System.Type.GetType("System.Int32");
            //column.ColumnName = "edition_list_id";
            //column.ReadOnly = true;
            //column.Unique = true;
            //// Add the Column to the DataColumnCollection.
            //tableCard.Columns.Add(column);

            column = new DataColumn();
            column.DataType = System.Type.GetType("System.Int32");
            column.ColumnName = "set_list_id";
            column.AutoIncrement = false;
            //column.Caption = "ParentItem";
            column.ReadOnly = false;
            column.Unique = false;
            // Add the column to the tableCard.
            tableCard.Columns.Add(column);

            column = new DataColumn();
            column.DataType = System.Type.GetType("System.Int32");
            column.ColumnName = "_year";
            column.AutoIncrement = false;
            //column.Caption = "ParentItem";
            column.ReadOnly = false;
            column.Unique = false;
            // Add the column to the tableCard.
            tableCard.Columns.Add(column);

            // Create second column.
            column = new DataColumn();
            column.DataType = System.Type.GetType("System.String");
            column.ColumnName = "edition";
            column.AutoIncrement = false;
            //column.Caption = "ParentItem";
            column.MaxLength = 64;
            column.ReadOnly = false;
            column.Unique = false;
            // Add the column to the tableCard.
            tableCard.Columns.Add(column);

            outSet.Tables.Add(tableCard);



            row = tableCard.NewRow();
            row["edition"] = textBox_Edition.Text;
            row["set_list_id"] = Convert.ToInt32(comboBox_Set.SelectedIndex);
            row["_year"] =textBox_Year.Text;
            tableCard.Rows.Add(row);

        }
    }
}
